package com.fancon.rage.comic.domain;

import java.io.Serializable;
import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.persistence.Id;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class Image implements Serializable /* needs serializable to be able to put in a cache */ {
	
	/**
	 * Generated serialVersionUID
	 */
	private static final long serialVersionUID = 237498273499L;

//	@PrimaryKey
//    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
//    private Key key;
//
//    @Persistent
//    private String url;
//    
//    @Persistent
//    private String thumbUrl;
//    
//    @Persistent
//    private String description;
//    
//    @Persistent
//    private Integer vote;
//    
//    @Persistent
//    private Date date;
//
//    public Image(String url, String thumbUrl,  String description, Date date) {
//        this.url = url;
//        this.thumbUrl = thumbUrl;
//        this.description = description;
//        this.date = date;
//    }
//
//    public Key getKey() {
//        return key;
//    }
//
//
//    public Date getDate() {
//        return date;
//    }
//
//
//    public void setDate(Date date) {
//        this.date = date;
//    }
//
//	public String getUrl() {
//		return url;
//	}
//
//	public void setUrl(String url) {
//		this.url = url;
//	}
//
//	public String getThumbUrl() {
//		return thumbUrl;
//	}
//
//	public void setThumbUrl(String thumbUrl) {
//		this.thumbUrl = thumbUrl;
//	}
//
//	public String getDescription() {
//		return description;
//	}
//
//	public void setDescription(String description) {
//		this.description = description;
//	}
//
//	public Integer getVote() {
//		return vote;
//	}
//
//	public void setVote(Integer vote) {
//		this.vote = vote;
//	}
//
//	public void setKey(Key key) {
//		this.key = key;
//	}
//}

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;
	@Persistent
    private String title;
	@Persistent
    private String caption;
	@Persistent
    private String contentType;
	@Persistent
    private byte[] photoData;
	@Persistent
    private String photoPath;

    public Image() {

    }

    public Image(String title, String caption) {
        super();
        this.title = title;
        this.caption = caption;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getCaption() {
        return caption;
    }

    public void setCaption(String caption) {
        this.caption = caption;
    }

    public byte[] getPhotoData() {
        return photoData;
    }

    public void setPhotoData(byte[] photoData) {
        this.photoData = photoData;
    }

    public String getPhotoPath() {
        return photoPath;
    }

    public void setPhotoPath(String photoPath) {
        this.photoPath = photoPath;
    }

    @Override
    public String toString() {
        return "Photo [id=" + id + ", title=" + title + ", caption=" + caption + ", contentType=" + contentType
                + ", photoPath=" + photoPath + "]";
    }

}
